package com.xiaoyun.advicetemplate.handler;

import com.xiaoyun.advicetemplate.vo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public Result error(RuntimeException exception) {
        return Result.errorMsg(exception.getMessage());
    }
}
